package com.zzxy.spring.po;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;
public class User implements BeanNameAware, BeanFactoryAware, InitializingBean , DisposableBean {
    private String username;
    private String password;

    public User(String username, String password) {
        this.username = username;
        this.password =password;
    }

    @java.lang.Override
    public java.lang.String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        System.out.println("2.set properties ...");
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public void setBeanName(String beanName) {
        System.out.println("3. set  bean name ..." + beanName);
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("4. set bean factory ...");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("6.  after properties ...");
    }

    public void myInit() {
        System.out.println("7. custom init func ...");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("9. destroy ...");
    }


    public void myDestroy() {
        System.out.println("10. custom destroy func ...");
    }
}
